<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title th:text="${session.title}">123</title>
    <link th:replace="common/header"/>
    <link rel="stylesheet" th:href="@{/css/ace-skins.min.css}"/>
    <link th:replace="common/tip"/>
</head>
<body class="navbar-fixed">
<div th:replace="common/top"></div>
<div class="container-fluid main_bg" id="main-container">
    <a id="menu-toggler" href="#"><span></span></a>
    <div th:replace="common/menu"></div>
    <div id="main-content" class="clearfix">
        <div id="page-content" class="clearfix">
            <div th:replace="common/title"></div>
            <h3 class="header smaller lighter blue"><em class="icon-list"></em>抽奖</h3>
            <div class="row-fluid" th:if="${session.footUser.qx.text == '会员' || session.footUser.qx.text == 'VIP1' || session.footUser.qx.text == 'VIP2' || session.footUser.qx.text == 'VIP3'}">
                <div class="span12">
                    <label th:if="${times > 0}">您还可以免费抽取<span id="times" th:text="${times}">123</span>次</label><label th:text="${msg}">123</label>
                    <button class="btn btn-warning" id="freeButton" type="button" onclick="rewardFree()" th:if="${times != null && times > 0}">免费抽奖</button>
                    <button class="btn btn-warning" type="button" onclick="reward()" th:text="${'花费' + needMoney + 'PB抽奖'}">花费抽奖</button>
                    <a class="btn" type="button" th:href="@{/index}"><em class="icon-arrow-left"></em>返回首页</a>
                </div>
            </div>
        </div>
        <div th:replace="common/skin :: skin"></div>
    </div>
    <!--/#main-content-->
</div>
<!--/.fluid-container#main-container-->
<div th:replace="common/jsList"></div>
<script>
    function rewardFree(){
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footRewardDetail/rewardFree",
            success: function (data) {
                if (data.msg === 'ok') {
                    var name = data.obj.yw + (data.obj.name === null ? '' : '(' + data.obj.name + ')');
                    showTip('tip', '免费抽取' + name, 4000);
                    window.setTimeout("window.location.reload()", 4000);
                }
            }
        });
    }

    function reward(){
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footRewardDetail/reward",
            success: function (data) {
                if (data.msg === 'ok') {
                    var name = data.obj.yw + (data.obj.name === null ? '' : '(' + data.obj.name + ')');
                    showTip('tip', '收费抽取' + name, 4000);
                    window.setTimeout("window.location.reload()", 4000);
                }
            }
        });
    }
</script>
</body>
</html>